/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ecfdb;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author SIDALI
 */
@Entity
@Table(name = "fellah", catalog = "mandataire", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Fellah.findAll", query = "SELECT f FROM Fellah f"),
    @NamedQuery(name = "Fellah.findByIdfellah", query = "SELECT f FROM Fellah f WHERE f.idfellah = :idfellah"),
    @NamedQuery(name = "Fellah.findByNom", query = "SELECT f FROM Fellah f WHERE f.nom = :nom"),
    @NamedQuery(name = "Fellah.findByDateEnregistrement", query = "SELECT f FROM Fellah f WHERE f.dateEnregistrement = :dateEnregistrement"),
    @NamedQuery(name = "Fellah.findByAdresse", query = "SELECT f FROM Fellah f WHERE f.adresse = :adresse"),
    @NamedQuery(name = "Fellah.findByTelephone", query = "SELECT f FROM Fellah f WHERE f.telephone = :telephone"),
    @NamedQuery(name = "Fellah.findBySolde", query = "SELECT f FROM Fellah f WHERE f.solde = :solde")})
public class Fellah implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idfellah", nullable = false)
    private Integer idfellah;
    @Column(name = "nom", length = 45)
    private String nom;
    @Column(name = "date_enregistrement")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateEnregistrement;
    @Column(name = "adresse", length = 45)
    private String adresse;
    @Column(name = "telephone")
    private Integer telephone;
    @Column(name = "solde")
    private Integer solde;
    @OneToMany(mappedBy = "idFellah")
    private List<Depot> depotList;
    @OneToMany(mappedBy = "idFellah")
    private List<CreditFellah> creditFellahList;

    public Fellah() {
    }

    public Fellah(Integer idfellah) {
        this.idfellah = idfellah;
    }

    public Integer getIdfellah() {
        return idfellah;
    }

    public void setIdfellah(Integer idfellah) {
        this.idfellah = idfellah;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public Date getDateEnregistrement() {
        return dateEnregistrement;
    }

    public void setDateEnregistrement(Date dateEnregistrement) {
        this.dateEnregistrement = dateEnregistrement;
    }

    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    public Integer getTelephone() {
        return telephone;
    }

    public void setTelephone(Integer telephone) {
        this.telephone = telephone;
    }

    public Integer getSolde() {
        return solde;
    }

    public void setSolde(Integer solde) {
        this.solde = solde;
    }

    @XmlTransient
    public List<Depot> getDepotList() {
        return depotList;
    }

    public void setDepotList(List<Depot> depotList) {
        this.depotList = depotList;
    }

    @XmlTransient
    public List<CreditFellah> getCreditFellahList() {
        return creditFellahList;
    }

    public void setCreditFellahList(List<CreditFellah> creditFellahList) {
        this.creditFellahList = creditFellahList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idfellah != null ? idfellah.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fellah)) {
            return false;
        }
        Fellah other = (Fellah) object;
        if ((this.idfellah == null && other.idfellah != null) || (this.idfellah != null && !this.idfellah.equals(other.idfellah))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return getNom();
    }
    
}
